<template>
    <ComAttachIndex bucketName="tender" :relationId="tenderId" />
</template>
<script>
// import ossRequest from '@/api/oss/oss.js'
// import { ip } from '@/utils/request'
import ComAttachIndex from '@/components/common/attachIndex'

export default {
    data () {
        return {
            // ip: ip + '/oss/uploader',
            attachTableData: [],
            attachSelection: []
        }
    },
    computed: {
        tenderId () {
            return this.$route.query.tenderId || this.$route.query.billid
        }
    },
    components: {
        ComAttachIndex
    },
    created () {
        // this.getObjectByRelationId()
    },
    methods: {
        // deleteData () {
        //     const length = this.attachSelection.length
        //     this.clientPop(
        //         'info',
        //         `已选择【${length}】条数据，确定要删除吗？数据删除后不可恢复，请谨慎操作！`,
        //         this.attachDel
        //     )
        // },
        // attachDownload () {
        //     // openDownloadDialog()
        //     window.open(this.attachSelection[0].objectPath)
        // },
        // attachDel () {
        //     const recordIds = this.attachSelection.map(value => value.recordId)
        //     const recordIdsLength = recordIds.length
        //     new Promise(resolve => {
        //         let length = 0
        //         recordIds.forEach(value => {
        //             ossRequest.deleterRecordId({ recordId: value }).then(() => {
        //                 length += 1
        //                 if (length == recordIdsLength) {
        //                     resolve()
        //                 }
        //             })
        //         })
        //     })
        //         .then(() => {
        //             const callBack = () => {
        //                 ossRequest
        //                     .getObjectByRelationId({ relationId: this.tenderId })
        //                     .then(res => {
        //                         this.attachTableData = res
        //                     })
        //             }
        //             this.clientPop('suc', '删除成功', callBack)
        //         })
        //         .catch(() => {
        //             const callBack = () => {
        //                 ossRequest
        //                     .getObjectByRelationId({ relationId: this.tenderId })
        //                     .then(res => {
        //                         this.attachTableData = res
        //                     })
        //             }
        //             this.clientPop('err', '部分数据删除失败', callBack)
        //         })
        // },
        // attachSelectionChange (selection) {
        //     this.attachSelection = selection
        // },
        // getObjectByRelationId () {
        //     ossRequest.getObjectByRelationId({ relationId: this.tenderId }).then(res => {
        //         this.attachTableData = res
        //     })
        // },
        // attachOnSuccess () {
        //     ossRequest.getObjectByRelationId({ relationId: this.tenderId }).then(res => {
        //         this.attachTableData = res
        //     })
        // }
    }
}
</script>
<style lang="scss" scoped>
.e-table {
    background-color: #fff;
}
.upload {
    margin: 20px auto;
    display: flex;
    justify-content: center;
    text-align: center;
}

.upload-demo {
    display: flex;
    justify-content: center;
    align-items: center;
}
</style>
